function drawApplet(id, applet)
{
    var obj = document.getElementById(id);
    if (! obj) {
        return;
    }
    var newContent = "";
    var standbyATTR = '';
    if (applet.standby) {
        standbyATTR = ' standby="' + applet.standby + '"';
    }
    var ua = getBrowserName();
    var classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
    var codebase = "http://java.sun.com/update/1.6.0/jinstall-6-fcs-windows-i586.cab";
    var unloadContent = "";
    if (applet.unloadContent) {
        unloadContent = applet.unloadContent;
    }
    var innerId = applet.id + '_i';
    if (applet.innerId) {
        innerId = applet.innerId;
    }
    var inner_object_html = '<object id="' + ((ua == "msie") ? id : innerId) +
        '" classid="' + classid +
        '" codebase="' + codebase +
        '" height="' + applet.height +
        '" width="' + applet.width + standbyATTR + '">';
        inner_object_html += '<param name="mayscript" value="true" />';
        inner_object_html += '<param name="code" value="' + applet.className + '" />';
        inner_object_html += '<param name="archive" value="' + applet.url + '" />';
        inner_object_html += unloadContent;
    inner_object_html += '</object>';

    if (ua == "msie") {
        newContent = inner_object_html;
    } else {
        var add_param = "";
        if (ua == "konqueror") {
            add_param = '<param name="archive" value="' + applet.url + '" />';
        }
        var object_html = '<object type="application/x-java-applet" id="' + innerId +
            '" classid="java:' + applet.className +
            '.class" archive="' + applet.url +
            '" height="' + applet.height +
            '" width="' + applet.width + standbyATTR + '" >' + add_param;
            object_html += '<param name="mayscript" value="true" />';
            object_html += inner_object_html;
        object_html += '</object>';

        newContent = object_html;
    }

    obj.innerHTML = newContent;
}

function drawApplets(applets)
{
    for (var i = 0; i < applets.length; i++) {
        drawApplet(applets[i].id, applets[i]);
    }
}

if (typeof applets != "undefined") {
    drawApplets(applets);
}